<?php
#echo '<pre>',print_r($_SERVER),'</pre>';
if(!empty($_SERVER['HTTP_X_FORWARDED_PROTO']))
        return $_SERVER['HTTP_X_FORWARDED_PROTO'];
    else 
        echo !empty($_SERVER['HTTPS']) ? "https" : "http";
?>
